<extend name="Base/common"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/bootstrap.min.css">
<block name="right">
	<div class="main-container">
        <div class="padding-md showmodal">
            <div class="row">
                <div class="col-sm-12">
                    <div class="page-title">
                         新增委托
                    </div>
                </div>
            </div>
            <div class="col-sm-12 row chach">
			<form method="post" action="__SELF__" class="form-hori" >
				<p class="c-p1">查新项目信息</p>
				<div class="form-group">
					<label  class="c-p2">查新机构</label><br/>
					<input type="text" data-toggle="modal" data-target="#myModal" id="chose_jg"  class="form-control" placeholder="点击可选择机构" style="width: 350px" readonly>
				</div>
				<!-- ================== -->
				<div class="form-group">
					<label  class="c-p2">查新范围<span>*</span></label><br/>
					<label class="radio-inline">
						<input type="radio" name="cxfw" value="1"  onclick="click_name()" checked/>&nbsp&nbsp国内
					</label>
					<label class="radio-inline">
						<input type="radio" name="cxfw" value="2"  onclick="click_name()" />&nbsp&nbsp国外
					</label>
					<label class="radio-inline">
						<input type="radio" name="cxfw" value="3"  onclick="click_name()"/>&nbsp&nbsp国内外
					</label>
				</div>
				<!-- ================= -->
				<div class="form-group zhong_name" >
					<label  class="c-p2">项目中文名称<span>*</span></label>
					<input type="text" name="xmmc" class="form-control" placeholder="请输入项目中文名称"  >
				</div>
				<!-- ================= -->
				<div class="form-group wai_name" style="display: none" >
					<label  class="c-p2">项目英文名称<span>*</span></label>
					<input type="text" name="xmmcen" class="form-control waiwen" placeholder="国外查新请输入项目英文名称"  >
				</div>
				<!-- =========================================== -->
				<div class="c-inline">
					<div class="c-select" style="width: 600px;">
						<label  class="c-p2">项目所属学科<span></span></label>
						<select style="width: 192px;margin-right: 10px;display: inline-block" onchange="select_cx(this)" class="form-control waiwen">
							<option value="">请选择学科</option>
							<volist name=":getSchoolTypeSelect()" id="vo">
								<eq name="key" value="$info.subject_yj">
									<option value="{$key}" selected="selected">{$vo}</option>
									<else/>
									<option value="{$key}">{$vo}</option>
								</eq>
							</volist>
						</select>
						<span id="sub_list" style="   " >

						</span>
					</div>
				</div>
				<div class="fenggege"></div>
				<p class="c-p1">查新目的</p>
				<p class="c-p2">查新目的<span>*</span></p>
				<div class="form-group" id="chaxinmudi">
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="1" class="show_action"  onclick="research(this)" data_dd="1">  科研立项
					</label>
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="2" > 鉴定、验收、评价
					</label>
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="3" >  奖励申报
					</label>
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="4" >  申请专利
					</label>
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="5" >  博硕士论文开题
					</label>
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="7" >申报高新技术企业
					</label>
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="8" >申报高新技术产品
					</label>
					<label class="checkbox-inline">
						<input type="checkbox" name="cxmd[]" value="6" data_dd="1"  onclick="other_mu(this)">  其他
					</label>
					<div id="cxmd_other" style="margin-top:6px;display: none">
						<input type="text" class="form-control chaxin" placeholder="" name="cxmd_other" >
					</div>
				</div>
				<!-- =========================================== -->
				<div class="form-group" id="xxcxmd" style="display: block">
					<label  class="c-p2">详细查新目的<span></span></label>
					<textarea class="form-control xxcxmd " rows="3"  placeholder="科研立项，请填写详细查新目的，如“申报国家自然科学基金项目”" name="xxcxmd" style="height: 200px ;"></textarea>
				</div>

				<!-- =========================================== -->
				<div class="form-group" id="form-group-c1">
					<label  class="c-p2">项目级别<span>*</span></label><br/>
					<volist name=":getLevelRadio()" id="vo">
						<label class="radio-inline">
							<input type="radio" name="xmjb"  value="{$key}" checked> {$vo}
						</label>
					</volist>
				</div>
				<p class="c-p1">查新点与技术要求</p>
				<div class="form-group">
					<label  class="c-p2">查新点<span>*</span></label>
					<textarea class="form-control" rows="3" placeholder="需要查证的内容要点，即与其他类似研究不同之处" name="show_add_cxd" style="height: 200px ;width: 740"></textarea>
				</div>
				<!-- =========================================== -->
				<div class="form-group">
					<label  class="c-p2">技术要求<span>*</span></label>
					<textarea class="form-control" rows="3" style="height: 200px ;" placeholder="着重说明查新项目的主要科学技术特征、技术参数或指标、结构、生产工艺、配方成份、应用范围、查新委托人自我判断的新颖性等。" name="jsd" style="width: 740px;"></textarea>
				</div>
				<!-- =========================================== -->
				<p class="c-p1">查新要求</p>
				<label  class="c-p2">查新要求<span>*</span></label>
				<p class="c-p4">
					<div class="checkbox">
						<div style="margin-left: 20px;" >
							<input type="checkbox" name="cxyq[]" value="1"/>希望查新机构通过查新，证明在所查范围内有无相同或类似研究
						</div>
						<div  style="margin-left: 20px;margin-top: 6px">
							<input type="checkbox" name="cxyq[]" value="2"/>希望查新机构对查新项目分别或综合进行对比分析
						</div>
						<div style="margin-left: 20px;margin-top: 6px" >
							<input type="checkbox" name="cxyq[]" value="3" onclick="other_cxyq(this)" data_dd="1"/>查新委托人提出的其他愿望
						</div>
					</div>
					<input type="text" class="form-control" placeholder="" style="float: none;width: 740px;display: none"  name="qtyq" id="qtyq">
				</p>
				<div class="form-group" id="form-group-c2">
					<label  class="c-p2">期望完成日期 <span>*</span></label>
					<!--<input type="text" class="form-control" name="lqrq"  readonly="readonly" onfocus="WdatePicker({minDate:'%y-%M-{%d}',disabledDays:[6,0],skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate:'{:date('Y-m-d',time()+3600*24*3)}'})" >-->
					<input type="text" class="form-control" name="lqrq"  readonly="readonly"  onfocus="
						WdatePicker({minDate:'%y-%M-{%d}',disabledDays:[6,0],
						skin:'whyGreen',dateFmt:'yyyy-MM-dd',
						minDate:'{:date('Y-m-d',time()+3600*24*2)}',
						maxDate:'{:date('Y-m-d',time()+3600*24*28)}'})
						" >
					<div><span style="position: relative;left: 324px;top: -27px;color: red;">从当前日期算起，第2个基本工作日后日期可选</span></div>

				</div>
				<div class="fenggege"></div>
				<p class="c-p1">检索要求</p>
				<div class="form-group ">
					<label  class="c-p2">中文检索词<span>*</span></label>
					<textarea class="form-control" rows="3" placeholder="规范词、同义词、广义词、狭义词、相关词" name="keywords_cn"style="height: 200px ;width: 740px;" ></textarea>
				</div>
				<!-- =========================================== -->
				<div class="form-group wai_name" style="display: none; ">
					<label  class="c-p2">外文检索词<span>*</span></label>
					<textarea class="form-control waiwen" rows="3" placeholder="国外、国内外检索必填"  name="keywords_en" style="height: 200px ;width: 740px;"></textarea>
				</div>
				<div class="form-group">
					<label  class="c-p2">检索数量备注</label>
					<textarea class="form-control" rows="3" placeholder="国内外相关文献量篇数、国内外密切相关文献量篇数" name="show_user_jf_pubdate" style="height: 200px ;width: 740px;"></textarea>
				</div>

				<!-- =========================================== -->
				<p class="c-p1">其他</p>
				<div class="form-group"  id="form-group-c3">
					<label  class="c-p2">附件</label><br/>
					<input type='text' name='textfield' id='textfield' class="form-control_1" readonly="readonly" />
					<input type='button' class='btn_liu' value='选择文件' />
					<input type="hidden" name="sqfj" id="upload_icoB" value="{$info.sqfj}"/>
					<input type="file"   class="file_2" onchange="ajaxFileUpload('icoB');" id="icoB" name="icoB">
					<span style="color: red">(只支持.doc .rar后缀的文件)</span>
				</div>
				<div class="main_chaxin_1_2-8">
					<!--<span class="span2">查看文档</span><br/>-->
					<div id="show_upload_message_icoB" class="span2">
						<foreach name="sqfj_arr" item="vo" >
							<if condition="$vo neq ''">
								<div id="file_id_{$vo}">
									<a style="color:blue;" target="_blank" href="{:U('down_file')}?file_id={$vo}">查看文档</a>
									&nbsp;&nbsp;&nbsp;&nbsp;
									<a style="color:blue;" href="javascript:del_file({$vo},'icoB')">删除</a>
								</div>
							</if>
						</foreach>
					</div>
				</div>
				<!-- =========================================== -->
				<div class="form-group">
					<label  class="c-p2">其他说明</label>
					<textarea class="form-control" rows="3" placeholder=""  name="contents" style="height: 200px ;width: 740px%"></textarea>
				</div>
				<!-- =========================================== -->
				<div class="fenggege"></div>
				<div class="qianming">
					<div class="qianming-1">
						<p class="c-p1">委托人签名<span>*</span></p>
						<input type="text" class="form-control" name="wtr_name" placeholder=""	value="{$wtrname}" readonly="readonly">
					</div>
					<div class="qianming-1">
						<p class="c-p1">委托时间</p>
						<input class="form-control" size="16" type="text" value="{$now}" disabled>
					</div>
					<!--<div class="qianming-2">-->
						<!--<p class="c-p1">查新员签名</p>-->
						<!--<input type="text" class="form-control" placeholder="" disabled>-->
					<!--</div>-->
				</div>
				<!--<div class="qianming1">-->
					<!-- -->
					<!--&lt;!&ndash;<div class="qianming-2">&ndash;&gt;-->
						<!--&lt;!&ndash;<p class="c-p1">完成时间</p>&ndash;&gt;-->
						<!--&lt;!&ndash;<input class="form-control" size="16" type="text" value="" disabled>&ndash;&gt;-->
					<!--&lt;!&ndash;</div>&ndash;&gt;-->
				<!--</div>-->
				<input type="hidden" id="department_id" name="department_id">
				<input type="hidden" id="department_id2" >
				<input class="action-button ajax-post" value="保&nbsp;&nbsp;存" type="submit" style="margin-top: 30px" target-form="form-hori" >
			</form>
			<!-- =========form end============ -->
		</div>
	</div>
</div>
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		 aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content" style="width: 600px;">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
							aria-hidden="true">×
					</button>
					<h4 class="modal-title" id="myModalLabel">
						欢迎使用科技查新平台！
					</h4>
				</div>
				<div class="modal-body">
					<span class="tan_title">科技查新机构选择<a>（若您无需选择科技查新机构，请关闭该弹窗！）</a></span>
					<div>
						<div class="psanm">
							<div class="sejjr row">
								<div class="left-ps">南京地区</div>
								<div class="right-ps">
									<volist name="list" id="vo">
										<if condition="$vo['city'] eq '0'">
											<a  id="idselect_{$vo.fid}" onclick="selectDeparId('{$vo.fid}','{$vo.fid|getAgencynameById}')" >{$vo.fid|getAgencynameById}</a>
										</if>
									</volist>
								</div>
							</div>
							<div class="sejjr row">
								<div class="left-ps">苏锡常地区</div>
								<div class="right-ps">
									<volist name="list" id="vo">
										<if condition="($vo['city'] lt 4) AND ($vo['city'] gt 0)">
											<a  id="idselect_{$vo.fid}" onclick="selectDeparId('{$vo.fid}','{$vo.fid|getAgencynameById}')" >{$vo.fid|getAgencynameById}</a>
										</if>
									</volist>
								</div>
							</div>
							<div class="sejjr row">
								<div class="left-ps">其他地区</div>
								<div class="right-ps">
									<volist name="list" id="vo">
										<if condition="$vo['city'] gt 3">
											<a  id="idselect_{$vo.fid}" onclick="selectDeparId('{$vo.fid}','{$vo.fid|getAgencynameById}')" >{$vo.fid|getAgencynameById}</a>
										</if>
									</volist>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer" style="text-align: center;">
					<!--<button type="button" class="btn btn-default"-->
					<!--data-dismiss="modal">关闭-->
					<!--</button>-->
					<button type="button" class="btn btn-primary " data-dismiss="modal"  onclick="show_name(1)">
						确定
					</button>
					<button type="button" class="btn btn-primary " data-dismiss="modal"  onclick="show_name(2)">
						取消机构
					</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
<style>
	table tr td:nth-child(1) {
		text-align: right;
		width: 20%;
	}
	table tr{
		height: 23px;
	}
	.psanm .sejjr {
		margin-top: 10px;
		padding-bottom: 10px;
		border-bottom: 1px dotted #ddd;
	}
	.left-ps {
		float: left;
		width: 100px;
		color: #15b2a9;
		font-size: 15px;
		font-weight: 600;
	}
	.right-ps {
		width: 450px;
		float: left;

	}
	.right-ps a {
		padding: 3px 6px;
		border-radius: 2px;
		margin-bottom: 7px;
		display: inline-block;
		margin-right: 11px;
	}

	.modal-footer {
		border-top: none;
	}
	.tan_title{
		color: #15b2a9;
	}
	.tan_title a{
		color: #8c8c8c;
	}
	.modal-title{
		color: #15b2a9;
	}

	.fenfen{
		float: left;
		width: 490px;
		overflow: hidden;
	}
	.diqu{
		width: 100%;
		height: auto;
		margin-top: 20px;
	}
	.diqu span{
		font-size: 15px;
		color: #3c3c3c;
		float: left;
	}
	.diqu a{
		color:#15b2a9;
		padding: 3px 6px;
		border-radius: 2px;
		margin-bottom: 7px;

	}
	.diqu li .active1{
		background-color:#15b2a9;
		color: #fff;
	}
	.diqu .active1{
		background-color:#15b2a9;
		color: #fff;
	}
	.diqu a:hover{
		color: #fff;
		background-color:#15b2a9;
	}
	.diqu ul li{
		float: left;
		width: 33%;
		margin-bottom: 7px;
	}
	.fenfen1{
		float: left;
		width: 490px;
		overflow: hidden;
	}
	.fenfen2{
		float: left;
		width: 490px;
		overflow: hidden;
	}
	.modal.in .modal-dialog{
		top:20%
	}
	li{
		list-style: none;
	}
	.btn.btn-primary:hover, .btn.btn-primary:focus, .btn.btn-primary:active, .btn.btn-primary.active{
		background: #15b2a9;
	}
	.btn.btn-primary{
		background: #15b2a9;
		border: 1px solid #15b2a9;;
	}
	.right-ps a:hover{
		background-color: #15b2a9;
		color: #fff;
		cursor: pointer;
	}
	.active1 {
		background-color: #15b2a9;
		color: #fff !important;
	}
</style>
</block>

<block name="script">
    <!--<script src="__STATIC__/jquery/jquery.min.js"></script>-->
    <script src="__STATIC__/easing.jquery.js" type="text/javascript"></script>
    <!--<script src="__JS__/zzsc2.js" type="text/javascript"></script>-->
    <script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
    <script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
	<!--<script src="__STATIC__/bootstrap/js/bootstrap.min.js"></script>-->
    <script>
		var value = '';
		$(function () { $('#myModal').modal({
			keyboard: true
		})});
		//学科改变时的选择
		function select_cx(obj){
			var value = $(obj).val();
			var url = '{:U("Task/subject")}';
			$.ajax({
				type: "POST",
				url: url,
				data: {fid: value},
				dataType: "json",
				success: function (data) {
					$('#sub_list').empty();   //清空cate_list里面的所有内容
					var html = '';

					if(data.state==1){
						html += '<span style="margin-right: 0;padding-left: 30px;">二级学科</span>';
						html += '<select style="width: 192px;height: 30px;border: 1px solid #cccccc;margin-right: 10px;margin-top: -3px;"name="xkfl" >';
						for(var i=0;i<data.list.length;i++){
							html +="<option value='"+data['list'][i]['id']+"'>"+data['list'][i]['title']+"</option>";
						}
						html += '</select>';
					}else{
						layer.alert('请在后台添加二级学科！');
					}
					$('#sub_list').html(html);
				}
			});
		}
		function selectDeparId(id,name){
			if(id){
				$("#department_id").val(id);
//			$("#chose_jg").val(name);
				$(".right-ps a").removeClass("active1");
				$("#idselect_"+id).addClass('active1');
			}
		}

		//点击确认的时候把值传到前台并且关闭
		function show_name(id){
			if(id == 1)
			{
				var name = $('.right-ps a.active1').text();
				$("#chose_jg").val(name);
			}
			else    //取消选择
			{
				$('.right-ps a.active1').removeClass('active1');
				$("#chose_jg").val('');
				$("#department_id").val('');
			}
		}

		var getDataByParm = {
			//根据学科分类查询学校
			getCate : function (cate,obj) {
				if(cate == 'all'){
					$("#department_id2").val('');
				}
				var url = '{:U("Task/getCateType")}';
				$(obj).addClass('active1').siblings("a").removeClass("active1");
				$.ajax({
					type: "POST",
					url: url,
					data: {cate: cate},
					dataType: "json",
					success: function (data) {
						$('#cate_list').empty();   //清空cate_list里面的所有内容
						var html = '';
						var url = '/index.php/Home/__PUBLIC__/Home/public/login';
						if(data.state){
							for(var i=0;i<data.result.length;i++){
								html +="<li ><a href='javascript:;' id='idselect_"+data['result'][i]['id']+"'  onclick='selectDeparId("+data['result'][i]['id']+",\""+data['result'][i]['name']+"\")'>"+data['result'][i]['name']+"</a></li>";
							}
						}else{
							alert('数据错误');
						}
						$('#cate_list').html(html);
					}
				});
			},
			//根据城市查询学校
			getCity:function(city){
				var url = '/index.php/Home/Task/getCity';
				var _this = obj;
				$.ajax({
					type: "POST",
					url: url,
					data: {city: city},
					dataType: "json",
					success: function (data) {
						$('#cate_list').empty();   //清空cate_list里面的所有内容
						var url = '/index.php/Home/__PUBLIC__/Home/public/login';
						var html = '';
						if(data.state){
							for(var i=0;i<data.result.length;i++){
								html +="<a href='javascript:;' id='idselect_"+data['result'][i]['id']+"' onclick='selectDeparId("+data['result'][i]['id']+",\""+data['result'][i]['name']+"\")'>"+data['result'][i]['name']+"</a>";
							}
						}else{
							alert('数据错误');
						}
						$('#cate_list').html(html);
					}
				});
			},
		}
		 $(function(){
			 highlight_nav2("{:U('Task/a_add',array('user_type'=>1))}");

			//提交判断
			 $('#submit').click(function(){

				 var name   =$("input[name='xmmcen']");//项目名称英文
				 var fanwei =$("input[name='xmmc']");//项目名称中文
				 var show   = $("textarea[name='show_add_cxd']");
				 var jsd    = $("textarea[name='jsd']");
				 var xxcxmd = $(".xxcxmd");
				 var lqrq   = $("input[name='lqrq']").val();
				 var cxmd   = $("input[name='cxmd[]']:checked");
				 var cxyq   = $("input[name='cxyq[]']:checked");
				 var guo    = $('input[name="cxfw"]:checked').val();
				 var keywords_cn = $('textarea[name="keywords_cn"]');
				 var keywords_en = $('textarea[name="keywords_en"]');
				 var dwsh        = $("input[name='dwsh']:checked").val();
				 var qbfs        = $("input[name='qbfs']:checked").val();

				 if(fanwei.val() == ''){
					 alert('请填写项目中文名称');
					 fanwei.focus();
					 return false;
				 }
				 if(guo != 1){  //点击的是国内
					 if(name.val() == ''){
						 alert('请填写项目英文名称');
						 name.focus();
						 return false;
					 }
				 }

				 if(!cxmd.length){
					 alert('请选择查新目的');
					 return false;
				 }
				 //判断是否要输入目的
				 if($('.show_action').attr('data_dd') == 2){
					 if(xxcxmd.val()==''){
						 alert('请填写查新目的');
						 xxcxmd.focus();
						 return false;
					 }
				 }
				 if(show.val() == ''){
					 alert('请填写查新点');
					 show.focus();
					 return false;
				 }
				 if(jsd.val() == ''){
					 alert('请填写技术要求');
					 jsd.focus();
					 return false;
				 }
				 if(!cxyq.length){
					 alert('请选择查新要求');
					 return false;
				 }
				 if(lqrq == ''){
					 alert('请填写完成日期');
					 return false;
				 }
				 if(keywords_cn.val() == ''){
					 alert('请填写中文检索词');
					 keywords_cn.focus();
					 return false;
				 }
				 if(guo != 1){
					 if(keywords_en.val() == ''){
						 alert('请填写外文检索词');
						 keywords_en.focus();
						 return false;
					 }
				 }
				 $(this).submit();
			 })
		});
		//显示中英文
		 function click_name(){
			 var name = $("input[name='cxfw']:checked").val();
			 if(name == 1){
				 $('.zhong_name').show();
				 $('.wai_name').hide();
			 }else if(name == 2){
				 $('.zhong_name').show();
				 $('.wai_name').show();
			 }else{
				 $('.zhong_name').show();
				 $('.wai_name').show();
			 }
		 }

		 //科研目的
		 function research (obj) {
			 return false;
			 var name= $(obj).attr('data_dd');
			 if(name==1){
				 alert('请填写详细查新目的');
				 $('#xxcxmd').show();
				 $(obj).attr('data_dd','2')
			 }else{
				 $('#xxcxmd').hide();
				 $(obj).attr('data_dd','1')
			 }
		 }

		//显示其他
		function other_mu (obj) {
			var name= $(obj).attr('data_dd');
			if(name==1){
				$('#cxmd_other').show();
				$(obj).attr('data_dd','2')
			}else{
				$('#cxmd_other').hide();
				$(obj).attr('data_dd','1')
			}
		}

		//显示其他要求
		function other_cxyq (obj) {
			var name= $(obj).attr('data_dd');
			if(name==1){
				$('#qtyq').show();
				$(obj).attr('data_dd','2')
			}else{
				$('#qtyq').hide();
				$(obj).attr('data_dd','1')
			}
		}
        function xk_(){
            $("option:selected").each(function(){
                var xk_select=$(this).val();
                var xk_qt=$("input[name='show_cx_type']").val();
                if(xk_select){
                    $(".xk").attr({disabled:true});
                }else{
                    $(".xk").removeAttr("disabled");
                }
                if(xk_qt){
                    $(".xk_s").attr({disabled:true});
                }else{
                    $(".xk_s").removeAttr("disabled");
                }
            });
        }
		 //同步显示姓名
		 function show_content () {
			 $('#second').val($('#first').val());
		 }
    </script>
</block>
